package com.itheima.dao;

import com.itheima.domain.User;
import org.apache.ibatis.annotations.*;
import org.springframework.web.bind.annotation.DeleteMapping;

import java.util.List;

public interface UserDao {
    //添加
    @Insert("insert into user(userNAME,PASSWORD,realName,gender,birthday)values(#{userNAME},#{PASSWORD},#{realName},#{gender},#{birthday})")
    public boolean save(User user);

    // 修改
    @Update("delete from user where uuid = #{uuid}")
    public boolean update(User user);

    //  删除
    @Delete("delete from user where uuid = #{uuid}")
    public boolean delete(Integer uuid);

    // 查单个
    @Select("select * from user where uuid = #{uuid}")
    public User get(Integer uuid);

    //查全部
    @Select("select * from user")
    public List<User> getAll(int page,int size);

    //登录
    @Select("select * from user where userName=#{userNAME} and password=#{PASSWORD}")
    public User getByUserNameAndPassword(@Param("userNAME") String userNAME,@Param("PASSWORD") String PASSWORD);


}
